package cn.chenwx.bbsforum.controller;

import cn.chenwx.bbsforum.entity.Article;
import cn.chenwx.bbsforum.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    ArticleService articleService;

    @GetMapping("/")
    public String index(Model model){
        List<Article> article =articleService.findAllArticles();
        model.addAttribute("articles",article);
        return "index";
    }


}
